var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/configComponent/useColspan.ts
var useColspan_exports = {};
__export(useColspan_exports, {
  default: () => useColspan
});
module.exports = __toCommonJS(useColspan_exports);
var import_react = require("react");
var defaultBreakPairs = {
  480: 1,
  576: 1,
  768: 2,
  992: 3,
  1200: 3,
  1600: 4,
  1900: 4
};
var defaultBreakPoints = [480, 576, 768, 992, 1200, 1600, 1900];
function useColspan(id, customColspan) {
  const [k, o] = handleBreakPairs(customColspan, { ...defaultBreakPairs }, [...defaultBreakPoints]);
  const [breakPairs, setBreakPairs] = (0, import_react.useState)(() => o);
  const [breakPoints, setBreakPoints] = (0, import_react.useState)(() => k);
  function handleBreakPairs(breakPairs2, dPairs, dPoints) {
    if (!breakPairs2)
      return [dPoints, dPairs];
    if (typeof breakPairs2 === "number") {
      Object.keys(dPairs).forEach((b) => {
        dPairs[b] = breakPairs2;
      });
    } else {
      if (Array.isArray(breakPairs2)) {
        dPairs = (breakPoints || defaultBreakPoints).reduce((acc, point, index) => {
          acc[point] = customColspan[index] || breakPairs2[point];
          return acc;
        }, {});
      } else {
        dPoints = Object.keys(breakPairs2).map((item) => Number(item)).sort((a, b) => a - b);
        dPairs = breakPairs2;
      }
    }
    return [dPoints, dPairs];
  }
  function setBreakPairsOrPoints(breakPairs2) {
    const [k2, o2] = handleBreakPairs(breakPairs2, breakPairs2, breakPoints);
    setBreakPairs(o2);
    setBreakPoints(k2);
  }
  return { breakPairs, breakPoints, setBreakPairs: setBreakPairsOrPoints };
}
